/**
 * 通用类型定义
 */

// 基础响应类型
export interface ApiResponse<T = any> {
  code: number;
  data: T;
  message: string;
  success: boolean;
}

// 分页数据类型
export interface PaginationData<T = any> {
  list: T[];
  page: number;
  pageSize: number;
  total: number;
}

// 分页请求参数
export interface PaginationParams {
  page: number;
  pageSize: number;
  [key: string]: any;
}

// 用户信息类型
export interface UserInfo {
  id: string;
  username: string;
  nickname: string;
  avatar: string;
  gender: 'male' | 'female' | 'unknown';
  phone?: string;
  email?: string;
  createTime: number;
  updateTime: number;
}

// 登录表单数据类型
export interface LoginForm {
  username: string;
  password: string;
}

// 登录响应类型
export interface LoginResponse {
  token: string;
  refreshToken: string;
  userInfo: UserInfo;
}

// 产品类型
export interface Product {
  id: string;
  name: string;
  description: string;
  price: number;
  originalPrice?: number;
  image: string;
  images?: string[];
  category: string;
  tags?: string[];
  createTime: number;
  updateTime: number;
}

// 主题类型
export type Theme = 'light' | 'dark';

// 订单状态
export type OrderStatus = 'pending' | 'paid' | 'shipped' | 'delivered' | 'cancelled';

// 订单类型
export interface Order {
  id: string;
  userId: string;
  products: Array<{
    id: string;
    name: string;
    price: number;
    quantity: number;
    image: string;
  }>;
  totalAmount: number;
  status: OrderStatus;
  address?: Address;
  createTime: number;
  updateTime: number;
  payTime?: number;
  shipTime?: number;
  deliverTime?: number;
}

// 地址类型
export interface Address {
  id: string;
  userId: string;
  name: string;
  phone: string;
  province: string;
  city: string;
  district: string;
  detail: string;
  isDefault: boolean;
  createTime: number;
  updateTime: number;
}
